﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:ComicReader.Controls">

    <Style TargetType="Controls:ZoomPanner">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:ZoomPanner">
                    <Grid>
                        <Grid.Resources>

                            <!-- scroll viewer -->
                            <Style x:Key="ScrollViewerStyle" TargetType="ScrollViewer">
                                <Setter Property="HorizontalScrollBarVisibility" Value="Hidden" />
                                <Setter Property="VerticalScrollBarVisibility" Value="Hidden" />
                            </Style>

                            <!-- zoom area -->
                            <Style x:Key="ZoomAreaStyle" TargetType="StackPanel">
                                <Setter Property="Opacity" Value=".3" />
                                <Setter Property="HorizontalAlignment" Value="Right" />
                                <Setter Property="VerticalAlignment" Value="Bottom" />
                                <Setter Property="Margin" Value="15" />
                            </Style>

                            <!-- zoom slider -->
                            <Style x:Key="ZoomSliderStyle" TargetType="Slider">
                                <Setter Property="Width" Value="20" />
                                <Setter Property="Height" Value="70" />
                                <Setter Property="Cursor" Value="Arrow" />
                                <Setter Property="Orientation" Value="Vertical" />
                                <Setter Property="SmallChange" Value="0.1" />
                                <Setter Property="LargeChange" Value=".25" />
                                <Setter Property="Maximum" Value="10" />
                                <Setter Property="Minimum" Value=".5" />
                            </Style>

                            <!-- zoom label -->
                            <Style x:Key="ZoomLabelStyle" TargetType="TextBlock">
                                <Setter Property="HorizontalAlignment" Value="Center" />
                                <Setter Property="Foreground" Value="White" />
                            </Style>

                            <!-- slider border -->
                            <Style x:Key="WidgetBorderStyle" TargetType="Border">
                                <Setter Property="BorderThickness" Value="0" />
                                <Setter Property="CornerRadius" Value="10" />
                                <Setter Property="Background" Value="#80000000" />
                                <Setter Property="BorderBrush" Value="#80ffffff" />
                                <Setter Property="Padding" Value="7" />
                            </Style>

                        </Grid.Resources>
                        
                        <ScrollViewer x:Name="PART_ScrollViewer"                                       
                                      Style="{StaticResource ScrollViewerStyle}">

                            <Viewbox x:Name="PART_ViewBox" MinHeight="986" MinWidth="614" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <ContentControl Content="{TemplateBinding Content}" />
                            </Viewbox>
                        </ScrollViewer>

                        <!-- zoom -->
                        <StackPanel Style="{StaticResource ZoomAreaStyle}" x:Name="PART_ZoomSliderPanel">
                            <Border Style="{StaticResource WidgetBorderStyle}">
                                <StackPanel>
                                    <Slider Style="{StaticResource ZoomSliderStyle}" x:Name="PART_ZoomSlider" Minimum="1" Maximum="10"/>
                                    <TextBlock Style="{StaticResource ZoomLabelStyle}">Zoom</TextBlock>
                                </StackPanel>
                            </Border>
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>